<template>
  <div class="footer">
    <div class="toolbar">
      <div class="item" v-for="(item, index) in bottomTools" :key="index">
        <router-link :to="item.path">
          <div class="icon">
            <i :class="['iconfont', item.icon]"></i>
          </div>
          <div class="text">{{ item.text }}</div>
        </router-link>
      </div>
      <!-- 最后一个图标 -->
      <div class="measure">
        <el-popover placement="right" :width="400" trigger="click">
          <!-- 点击区域 -->
          <template #reference>
            <div class="icon">
              <i class="iconfont icon-juli"></i>
            </div>
          </template>
          <!-- 展示文本 -->
          <div class="displayMeasure">
            <div
              class="measureItem"
              v-for="(item, index) in measureList"
              :key="index"
            >
              <router-link :to="`/measure/${item.path}`">
                {{ item.title }}
              </router-link>
            </div>
          </div>
        </el-popover>
      </div>
    </div>
  </div>
</template>
<script setup>
const bottomTools = [
  {
    icon: 'icon-diqiu',
    text: '自转',
    path: '/rotate',
  },
  {
    icon: 'icon-kongzhitai',
    text: '控制台',
    path: '/PlotView',
  },
  {
    icon: 'icon-feiji',
    text: '城市视图',
    path: '/cityView',
  },
  {
    icon: 'icon-ic_search24px',
    text: '事故查询',
    path: '/search',
  },
  {
    icon: 'icon-xielaqiao',
    text: '桥梁',
    path: '/bridge',
  },
]

const measureList = [
  {
    title: '折线',
    path: 'line',
  },
  {
    title: '矩形',
    path: 'rect',
  },
  {
    title: '圆',
    path: 'circle',
  },
  {
    title: '多边形',
    path: 'polygon',
  },
]
</script>
<style lang="scss" scoped>
.footer {
  z-index: 10;
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100px;
  background: url('../assets/images/xzd-header.png') no-repeat;
  background-size: cover;
  .toolbar {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    .item {
      width: 70px;
      height: 70px;
      color: #fff;
      a {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
        text-decoration: none;
        color: #fff;
        .icon {
          width: 50px;
          height: 50px;
          background-color: #156ab5;
          border-radius: 50%;
          display: flex;
          justify-content: center;
          align-items: center;
          transition: all 0.2s;
          &:hover {
            transform: scale(1.3);
            background-color: #009688;
          }
          i {
            font-size: 25px;
          }
        }
        .text {
          font-size: 16px;
          text-align: center;
        }
      }
    }
    .measure {
      width: 70px;
      height: 70px;
      display: flex;
      justify-content: center;
      align-items: center;
      color: #fff;
      .icon {
        width: 50px;
        height: 50px;
        background-color: #156ab5;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        transition: all 0.2s;
        &:hover {
          transform: scale(1.3);
          background-color: #009688;
        }
      }
      .displayMeasure {
        background-color: #fff;
        border-radius: 10px;
        width: 100px;
        a {
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          text-decoration: none;
        }
      }
    }
  }
}
</style>
